{% extends "layouts/base.html" %}

{% block title %} 人员工时 {% endblock %}

<!-- Specific CSS goes HERE -->
{% block stylesheets %}{% endblock stylesheets %}

{% block content %}

    <!-- [ Main Content ] start -->
    <section class = "pcoded-main-container">
        <div class = "pcoded-content">
            <!-- [ breadcrumb ] start -->
            <div class = "page-header">
                <div class = "page-block">
                    <div class = "row align-items-center">
                        <div class = "col-md-12">
                            <div class = "page-header-title">
                                <h5 class = "m-b-10">人员工时表</h5>
                            </div>
                            <ul class = "breadcrumb">
                                <li class = "breadcrumb-item"><a href = "{% url 'index' %}">
                                    <i class = "feather icon-home"></i></a></li>
                                <li class = "breadcrumb-item"><a href = "#!">工时管理</a></li>
                                <li class = "breadcrumb-item"><a href = "#!">人员工时</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            <!-- [ breadcrumb ] end -->
            <!-- [ Main Content ] start -->
            <div class = "row">
                <!-- [ stiped-table ] start -->
                <div class = "col-xl-12">
                    <div class = "card">
                        <div class = "card-header">
                            <div class = "row">
                                <div class = "col-md-4 align-items-center">
                                    <a href = "{% url 'add_employee_hour' %}" class = "btn btn-primary">
                                        <i class = "feather mr-2 icon-plus"></i>添加
                                    </a>
                                    <button class = "btn  btn-primary dropdown-toggle" type = "button"
                                            data-toggle = "dropdown" aria-haspopup = "true"
                                            aria-expanded = "false">
                                        <i class = "feather mr-2 icon-plus-square"></i>批量添加
                                    </button>
                                    <div class = "dropdown-menu">
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '炼胶' %}">炼胶</a>
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '涂胶' %}">涂胶</a>
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '成型' %}">成型</a>
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '二次加热' %}">二次加热</a>
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '液体成型' %}">液体成型</a>
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '研磨' %}">研磨</a>
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '静电' %}">静电</a>
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '切割' %}">切割</a>
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '自动机' %}">自动机</a>
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '机压' %}">机压</a>
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '手工作业' %}">手工作业</a>
                                        <a class = "dropdown-item" href = "{% url 'batch_edit_employee_hours' '冷冻' %}">冷冻</a>
                                    </div>

                                    <a href = "{% url 'export_excel' %}" class = "btn btn-primary">
                                        <i class = "feather mr-2 icon-download-cloud"></i>导出
                                    </a>
                                </div>
                                <div class = "col-md-4"></div>
                                <div class = "col-md-4 text-center">
                                    <div class = "input-group mb-2 mr-2">
                                        <!-- 搜索框 开始-->
                                        <form action = "{% url 'employee_hours' 1 %}" method = "get">
                                            <div class = "input-group mb-3" style = "width: 240px;">
                                                <input type = "text" class = "form-control fa-pull-right"
                                                       placeholder = "姓名/工序" name = "keyword">
                                                <div class = "input-group-append">
                                                    <button class = "btn  btn-primary" type = "submit">搜索
                                                    </button>
                                                </div>
                                            </div>
                                        </form>
                                        <!-- 搜索框 结束-->
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class = "card-body table-border-style">
                            <div class = "table-responsive">
                                <table class = "table table-striped table-bordered text-center table-sm">
                                    <thead class = "thead-light">
                                        <tr>
                                            <th>序号</th>
                                            <th>姓名</th>
                                            <th>工序</th>
                                            <th>工时</th>
                                            <th>日期</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        {% for h in employee_hours_list %}
                                            <tr>
                                                <td>{{ forloop.counter|add:ten_pIndex }}</td>
                                                <td>{{ h.e_name }}</td>
                                                <td>{{ h.e_process }}</td>
                                                <td>{{ h.e_hours }}</td>
                                                <td>{{ h.e_workday|date:"Y-m-d" }}</td>
                                                <td>
                                                    <a href = "{% url 'edit_employee_hour' h.id %}"
                                                       class = "btn btn-sm btn-info">
                                                        <i class = "feather mr-2 icon-edit-2"></i>修改
                                                    </a>
                                                    <a type = "button" class = "btn btn-sm btn-danger del"
                                                       href = "{% url 'del_employee_hour' h.id %}">
                                                        <i class = "feather mr-2 icon-trash-2"></i>删除
                                                    </a>
                                                </td>
                                            </tr>
                                        {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                            <nav aria-label = "Page navigation example">
                                <ul class = "pagination justify-content-end">
                                    <li {% if pIndex == 1 %}class = "page-item disabled"{% endif %} class = "page-item">
                                        <a class = "page-link"
                                           href = "{% url 'employee_hours' pIndex|add:-1 %}?{{ mywhere|join:"&" }}"
                                           tabindex = "-1">上一页</a>
                                    </li>
                                    {% for p in plist %}
                                        <li {% if p == pIndex %}class = "page-item active"{% endif %}
                                            class = "page-item">
                                            <a class = "page-link"
                                               href = "{% url 'employee_hours' p %}?{{ mywhere|join:"&" }}">{{ p }}</a>
                                        </li>
                                    {% endfor %}
                                    <li {% if pIndex == maxpages %}class = "page-item disabled"{% endif %}
                                        class = "page-item">
                                        <a class = "page-link"
                                           href = "{% url 'employee_hours' pIndex|add:1 %}?{{ mywhere|join:"&" }}">下一页</a>
                                    </li>
                                </ul>
                            </nav>
                        </div>
                        <div class = "card-footer">

                        </div>
                        <!-- table card -->


                    </div>
                    <!-- [ stiped-table ] end -->

                </div>
                <!-- [ Main Content ] end -->
            </div>
        </div>
    </section>
    <!-- [ Main Content ] end -->

{% endblock content %}

<!-- Specific Page JS goes HERE  -->
{% block javascripts %}

{% endblock javascripts %}
